  <!DOCTYPE html>
<html class="x-admin-sm">

  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="css/font.css">
    <link rel="stylesheet" href="css/xadmin.css">
    <script type="text/javascript" src="lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
              <a>
              <cite>合同业务</cite></a>
            <a href="">合同模板</a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
    </div>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <div class="layui-collapse" lay-filter="test">
                            <div class="layui-colla-item">
                                <h2 class="layui-colla-title">条件筛选<i class="layui-icon layui-colla-icon"></i></h2>
                                <div class="layui-colla-content">
                                  <form class="layui-form">
                                      <div class="layui-form-item">
                                        <div class="layui-input-block">
                                          <input type="checkbox" name="cpjl"  id="cpjl" title="产品经理">
                                          <input type="checkbox" name="ywjl"  id="ywjl" title="业务经理">
                                          <input type="checkbox" name="xqfxs" id="xqfxs" title="需求分析师">
                                          <input type="checkbox" name="xmzj"  id="xmzj" title="项目总监">
                                          <input type="checkbox" name="jszj"  id="jszj" title="技术总监"></div></div>
                                      <div class="layui-form-item">
                                        <div class="layui-input-block">
                                          <input type="checkbox" name="yyjgsjs" id="yyjgsjs" title="应用架构设计师">
                                          <input type="checkbox" name="jcptsjs" id="jcptsjs" title="基础平台设计师">
                                          <input type="checkbox" name="khdsjs"  id="khdsjs"  title="客户端(APP)设计师">
                                          <input type="checkbox" name="qdsjs"   id="qdsjs"   title="前端设计设计师">
                                          <input type="checkbox" name="uisjs"   id="uisjs"   title="UI设计师"></div></div>
                                      <div class="layui-form-item">
                                        <div class="layui-input-block">
                                          <input type="checkbox" name="javas" id="javas" title="java研发工程师">
                                          <input type="checkbox" name="az" id="az" title="安卓开发工程师">
                                          <input type="checkbox" name="pg" id="pg" title="苹果开发工程师">
                                          <input type="checkbox" name="c"  id="c" title="C#开发工程师">
                                          <input type="checkbox" name="qd" id="qd" title="前端开发工程师">
                                          <input type="checkbox" name="cs" id="cs" title="测试工程师">
                                          <input type="checkbox" name="ss" id="ss" title="实施工程师"></div></div>
                                      <hr class="layui-bg-gray">
                                      <div class="layui-form-item">
                                        <div class="layui-input-block">
                                          <button class="layui-btn layui-btn-lg"  lay-submit="" lay-filter="search">立即提交</button>
                                          <button type="reset" class="layui-btn layui-btn-lg layui-btn-primary">重置</button>
                                        </div>
                                      </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-card-body ">
                            <table id="demo" class="layui-table layui-form" lay-filter="demo"></table></div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/html" id="show">
      <a title="详情"  lay-event="show_details" href="javascript:;">详情<i class="layui-icon">&#xe642;</i></a>
    </script>
    <script>
          function setNum(idName){
                //console.log(idName + "。check=" + $('#'+idName).prop("checked"));
                if($('#'+idName).prop("checked") == true){
                    return 1;
                } else {
                    return null;
                }
            }
   </script>
   <script>
        layui.use(['table','form'], function(){
            var table = layui.table;
            table.render({
              elem: '#demo'
              ,id :'tableList'
              ,dateType: "json"
              ,contentType : "application/json"
              ,method: 'post'
              ,url: '/templateClient/clientList'
              ,cols: [[ //标题栏
                {field: 'modeId', title: '合同ID'}
                ,{field: 'modeName', title: '备注'}
                ,{fixed: 'right', title:'操作', toolbar: '#show'}
              ]]
              ,parseData: function(res){ //res 即为原始返回的数据
                console.log(res);
                return {
                    "code": 0,
                    "data": res.data.templateList,
                    "count": res.dataSize, //解析数据长度
                };
              }
              ,skin: 'row' //表格风格
              ,even: true
              ,page: true //是否显示分页
              ,limits: [5,10,20]
              ,limit: 5 //每页默认显示的数量
              ,done : function(res, curr, count){
                  table_data=res.data;
                  layer.closeAll('loading');
               }
            });

            var form = layui.form;
            form.on('submit(search)', function(data){
                //alert("搜索~")
                layer.load();
                table.reload('tableList', {
                    page: {
                      curr: 1 //重新从第 1 页开始
                    }
                    ,where:{
                      'xqdyCpjl' : setNum('cpjl'),
                      'xqdyXqfxs' : setNum('xqfxs'),
                      'xtsjCpjl' : setNum('cpjl'),
                      'xtsjYyjgsjs' : setNum('yyjgsjs'),
                      'xtsjJcptsjs' : setNum('jcptsjs'),
                      'xtsjKhdapisjs' : setNum('khdsjs'),
                      'xtsjQdsjfxs' : setNum('qdsjs'),
                      'xtsjUisjs' : setNum('uisjs'),
                      'xtkfJavayfgcs' : setNum('javas'),
                      'xtkfAzkfgcs' : setNum('az'),
                      'xtkfPgkfgcs' : setNum('pg'),
                      'xtkfCkfgcs' : setNum('c'),
                      'xtkfQdkfgcs' : setNum('qd'),
                      'xtcsCsgcs' : setNum('cs'),
                      'ywzcYwjl' : setNum('ywjl'),
                      'xtssSsgcs' : setNum('ss'),
                      'xmglXmzj' : setNum('xmzj'),
                      'jsglJszj' : setNum('jszj')
                    }
                 }); 
                 return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
             });
                        //监听行工具事件
            table.on('tool(demo)', function(obj) {
              var data = obj.data;
              if(obj.event === 'show_details') {
                  xadmin.open('详情','./template-show.html?modeId='+obj.data.modeId,800,800);
              }
            });
          });
    </script>
  </body>
</html>